GtkTreeView.get_tooltip_context() takes an inout X and Y coordinates,
but the "out" side is a side effect: the conversion from widget-relative
to bin window-relative coordinates is not documented, and can be done
using public API, if needed.
GtkIconView.get_tooltip_context() follows the same pattern, and takes
two inout arguments for the coordinates, but it does not change them any
more, after GtkIconView's bin window was dropped in commit
8dc5e13e.
There's really no point in having these `inout` arguments, and while
GtkTreeView and GtkIconView are certainly de-emphasised in GTK4, and we
nudge developers to move to the new list views, we should take advantage
of the API break to remove warts.
GtkAboutDialog now directly derives from GtkWindow, the GtkDialog API can no
longer be used on it.
+### Adapt to GtkTreeView and GtkIconView tooltip context changes
+
+The getter functions for retrieving the data from #GtkTreeView
+and #GtkIconView inside a #GtkWidget::query-tooltip signal do not take the
+pointer coordinates as inout arguments any more, but as normal in ones.
+
+See: gtk_tree_view_get_tooltip_context(), gtk_icon_view_get_tooltip_context()
+
## Changes to consider after the switch
GTK 4 has a number of new features that you may want to take
if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (impl->browse_files_tree_view),
- &x, &y,
+ x, y,
keyboard_tip,
&model, &path, &iter))
return FALSE;
/**
* gtk_icon_view_get_tooltip_context:
* @icon_view: an #GtkIconView
- * @x: (inout): the x coordinate (relative to widget coordinates)
- * @y: (inout): the y coordinate (relative to widget coordinates)
+ * @x: the x coordinate (relative to widget coordinates)
+ * @y: the y coordinate (relative to widget coordinates)
* @keyboard_tip: whether this is a keyboard tooltip or not
* @model: (out) (allow-none) (transfer none): a pointer to receive a
* #GtkTreeModel or %NULL
*/
gboolean
gtk_icon_view_get_tooltip_context (GtkIconView *icon_view,
- int *x,
- int *y,
+ int x,
+ int y,
gboolean keyboard_tip,
GtkTreeModel **model,
GtkTreePath **path,
GtkTreePath *tmppath = NULL;
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), FALSE);
- g_return_val_if_fail (x != NULL, FALSE);
- g_return_val_if_fail (y != NULL, FALSE);
if (keyboard_tip)
{
}
else
{
- if (!gtk_icon_view_get_item_at_pos (icon_view, *x, *y, &tmppath, NULL))
+ if (!gtk_icon_view_get_item_at_pos (icon_view, x, y, &tmppath, NULL))
return FALSE;
}
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
if (!gtk_icon_view_get_tooltip_context (GTK_ICON_VIEW (widget),
- &x, &y,
+ x, y,
keyboard_tip,
&model, &path, &iter))
return FALSE;
GtkCellRenderer *cell);
GDK_AVAILABLE_IN_ALL
gboolean gtk_icon_view_get_tooltip_context (GtkIconView *icon_view,
- int *x,
- int *y,
+ int x,
+ int y,
gboolean keyboard_tip,
GtkTreeModel **model,
GtkTreePath **path,
/**
* gtk_tree_view_get_tooltip_context:
* @tree_view: a #GtkTreeView
- * @x: (inout): the x coordinate (relative to widget coordinates)
- * @y: (inout): the y coordinate (relative to widget coordinates)
+ * @x: the x coordinate (relative to widget coordinates)
+ * @y: the y coordinate (relative to widget coordinates)
* @keyboard_tip: whether this is a keyboard tooltip or not
* @model: (out) (optional) (nullable) (transfer none): a pointer to
* receive a #GtkTreeModel or %NULL
*/
gboolean
gtk_tree_view_get_tooltip_context (GtkTreeView *tree_view,
- int *x,
- int *y,
+ int x,
+ int y,
gboolean keyboard_tip,
GtkTreeModel **model,
GtkTreePath **path,
GtkTreePath *tmppath = NULL;
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
- g_return_val_if_fail (x != NULL, FALSE);
- g_return_val_if_fail (y != NULL, FALSE);
if (keyboard_tip)
{
}
else
{
- gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, *x, *y,
- x, y);
+ int rel_x, rel_y;
- if (!gtk_tree_view_get_path_at_pos (tree_view, *x, *y,
+ gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y,
+ &rel_x, &rel_y);
+
+ if (!gtk_tree_view_get_path_at_pos (tree_view, rel_x, rel_y,
&tmppath, NULL, NULL, NULL))
return FALSE;
}
GtkTreeViewPrivate *priv = gtk_tree_view_get_instance_private (tree_view);
if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (widget),
- &x, &y,
+ x, y,
keyboard_tip,
&model, &path, &iter))
return FALSE;
GtkCellRenderer *cell);
GDK_AVAILABLE_IN_ALL
gboolean gtk_tree_view_get_tooltip_context(GtkTreeView *tree_view,
- int *x,
- int *y,
+ int x,
+ int y,
gboolean keyboard_tip,
GtkTreeModel **model,
GtkTreePath **path,
char buffer[512];
- if (!gtk_tree_view_get_tooltip_context (tree_view, &x, &y,
+ if (!gtk_tree_view_get_tooltip_context (tree_view, x, y,
keyboard_tip,
&model, &path, &iter))
return FALSE;